package top.shaozuo.simple.serialize;

import java.util.Iterator;
import java.util.ServiceLoader;

import top.shaozuo.simple.serialize.spi.SeriallizationProvider;

public final class Serializing {

	private Serializing() {

	}

	public static SeriallizationProvider getSeriallizationProvider() {
		Iterator<SeriallizationProvider> providers = ServiceLoader
		        .load(SeriallizationProvider.class).iterator();
		if (providers.hasNext()) {
			return providers.next();
		} else {
			throw new SerializationException("No SeriallizationProvider have been configured");
		}
	}
}
